package com.redis.demo.utils;

import com.redis.demo.lang.Renum;
import com.redis.demo.lang.Result;

/**
 * @date 2020/10/23 14:25
 */
public class ResultUtil {

    /**
     * 操作成功并且有数据返回时
     * @param object
     * @return result
     */
    public static Result success(Object object){
        return new Result(Renum.SUCCESS.getCode(),Renum.SUCCESS.getMsg(),object);
    }

    /**
     * 操作成功没有数据返回时
     * @return result
     */
    public static Result success(){
        return success(null);
    }

    /**
     * 操作失败
     * @param code
     * @param msg
     * @return result
     */
    public static Result fail(Integer code,String msg){
        return new Result(code,msg);
    }

}
